package sort;

import java.util.Arrays;

public class Test {
    public static void insertSortTest(int[] arr){
        int[] tmp = Arrays.copyOf(arr,arr.length);
        long startTime = System.currentTimeMillis();
        Sort.insertSort(tmp);
        long endTime = System.currentTimeMillis();
        System.out.println("直接插入排序耗时："+ (endTime-startTime));


    }
    public static void shellSortTest(int[] arr){
        int[] tmp = Arrays.copyOf(arr,arr.length);
        long startTime = System.currentTimeMillis();
        Sort.shellSort(tmp);
        long endTime = System.currentTimeMillis();
        System.out.println("希尔排序耗时："+ (endTime-startTime));


    }

    public static void selectSortTest(int[] arr){
        int[] tmp = Arrays.copyOf(arr,arr.length);
        long startTime = System.currentTimeMillis();
        Sort.selectSort(tmp);
        long endTime = System.currentTimeMillis();
        System.out.println("选择排序耗时："+ (endTime-startTime));


    }

    public static void main1(String[] args) {
        int[] arr = new int[1_0000];
        for (int i = 0; i < arr.length; i++){
            arr[i] = arr.length - i;
        }
        insertSortTest(arr);
        shellSortTest(arr);
        selectSortTest(arr);
    }
    public static void main(String[] args) {
        int[] arr = {1,3,15,61,100,17,8};
        Sort.insertSort(arr);
        System.out.println(Arrays.toString(arr));
        Sort.selectSort(arr);
        System.out.println(Arrays.toString(arr));
        Sort.selectSort2(arr);
        System.out.println(Arrays.toString(arr));
        Sort.bubbleSort(arr);
        System.out.println(Arrays.toString(arr));
        Sort.quickSort(arr);
        System.out.println(Arrays.toString(arr));
        Sort.quickSortNor(arr);
        System.out.println(Arrays.toString(arr));
        Sort.mergeSort(arr);
        System.out.println(Arrays.toString(arr));
        Sort.mergeSortNor(arr);
        System.out.println(Arrays.toString(arr));
        Sort.countSort(arr);
        System.out.println(Arrays.toString(arr));



    }
}
